﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.Mvvm.Messaging.Messages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MvvmTutorials.Messenger.ViewModels
{
    public partial class MainWindowViewModel
        : ObservableRecipient,
        IRecipient<PropertyChangedMessage<String>>
    {
        [ObservableProperty]
        private string information = "INSERT INTO Students ...";


        public void Receive(PropertyChangedMessage<string> message)
        {
            if (message.Sender is StudentFormViewModel vm)
            {
                Information = vm.SqlQuery;
            }
        }
    }
}
